﻿using System.Collections.Generic;
using Calculator.Models;
using System.Collections.Specialized;

namespace Calculator.ViewModels
{
    class ViewModelCalculator : ViewModelBase
    {
        ModelCalculator model;

        public ViewModelCalculator()
        {
            model = new ModelCalculator();
        }

        public double CalculateResult(string first, string second, char operation)
        {
            var a = double.Parse(first);
            var b = double.Parse(second);
            double result;
            switch (operation)
            {
                case '+':
                    result = a + b;
                    break;
                case '-':
                    result = a - b;
                    break;
                case '*':
                    result = a * b;
                    break;
                case '/':
                    result = a / b;
                    break;
                case 'S':
                    result = a - b;
                    break;
                case 'P':
                    result = a * b;
                    break;
                case 'L':
                    result = a / b;
                    break;
                default:
                    result = 0;
                    break;
            }
            return result;
        }
    }
}
